﻿<Window
	xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation"
	xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
	x:Class="View.WindowDiscussion"
	x:Name="Window"
	Title="WindowDiscussion"
	Width="660" Height="480"
    >
	<Window.Resources>
		<ControlTemplate x:Key="ButtonControlTemplate1" TargetType="{x:Type Button}">
			<ControlTemplate.Resources>
				<Storyboard x:Key="Storyboard1">
					<ColorAnimationUsingKeyFrames BeginTime="00:00:00" Storyboard.TargetName="textBlock" Storyboard.TargetProperty="(TextElement.Foreground).(SolidColorBrush.Color)">
						<SplineColorKeyFrame KeyTime="00:00:00.2000000" Value="#FFE82020"/>
					</ColorAnimationUsingKeyFrames>
				</Storyboard>
				<Storyboard x:Key="Storyboard2">
					<ColorAnimationUsingKeyFrames BeginTime="00:00:00" Storyboard.TargetName="textBlock" Storyboard.TargetProperty="(TextElement.Foreground).(SolidColorBrush.Color)">
						<SplineColorKeyFrame KeyTime="00:00:00.2000000" Value="#FF000000"/>
					</ColorAnimationUsingKeyFrames>
				</Storyboard>
			</ControlTemplate.Resources>
			<Grid RenderTransformOrigin="0.5,0.5">
				<Grid.RenderTransform>
					<TransformGroup>
						<ScaleTransform ScaleX="1" ScaleY="1"/>
						<SkewTransform AngleX="0" AngleY="0"/>
						<RotateTransform Angle="0"/>
						<TranslateTransform X="0" Y="0"/>
					</TransformGroup>
				</Grid.RenderTransform>
				<Grid Margin="0,0,0,0" Background="{x:Null}">
					<Rectangle Stroke="{x:Null}" Margin="0,0,0,0" VerticalAlignment="Stretch" RadiusX="5" RadiusY="5">
						<Rectangle.Fill>
							<LinearGradientBrush EndPoint="0.5,1" StartPoint="0.5,0">
								<GradientStop Color="#FFFFFFFF" Offset="0"/>
								<GradientStop Color="#FF5E99AF" Offset="1"/>
							</LinearGradientBrush>
						</Rectangle.Fill>
					</Rectangle>
					<TextBlock Margin="0,0,0,0" TextWrapping="Wrap" HorizontalAlignment="Center" VerticalAlignment="Center" FontWeight="Bold" FontFamily="Comic Sans MS" x:Name="textBlock" Background="{x:Null}"><Run Text="X" Language="fr-fr"/></TextBlock>
					
				</Grid>
			</Grid>
			<ControlTemplate.Triggers>
				<Trigger Property="IsMouseOver" Value="True">
					<Trigger.ExitActions>
						<BeginStoryboard Storyboard="{StaticResource Storyboard2}" x:Name="Storyboard2_BeginStoryboard"/>
					</Trigger.ExitActions>
					<Trigger.EnterActions>
						<BeginStoryboard Storyboard="{StaticResource Storyboard1}" x:Name="Storyboard1_BeginStoryboard"/>
					</Trigger.EnterActions>
				</Trigger>
			</ControlTemplate.Triggers>
		</ControlTemplate>
        

    </Window.Resources>

	<Grid x:Name="LayoutRoot" Background="{DynamicResource Brush1}">
		<TabControl SelectedIndex="0" ItemsSource="{Binding Path=Discussions}" Margin="8,8,140,104" IsSynchronizedWithCurrentItem="True" x:Name="tabControlDiscussion" TabStripPlacement="Top">
            <TabControl.ContentTemplate>
                <DataTemplate>
                    <ListView ItemsSource="{Binding Path=Messages, IsAsync=True}" Margin="15,15,15,15" IsSynchronizedWithCurrentItem="True" HorizontalAlignment="Stretch" VerticalAlignment="Stretch" x:Name="listBoxContacts" SelectionMode="Single">
                        <ListView.View>
                            <GridView>
                                <GridViewColumn Width="500">
                                    <GridViewColumn.CellTemplate>
                                        <DataTemplate>
                                            <Grid Height="Auto" MinHeight="30" x:Name="gridMessage" MinWidth="400">
                                                <TextBlock Text="Message de " VerticalAlignment="Top" Foreground="Gray"/>
                                                <TextBlock Text="{Binding Path=From.Alias}" HorizontalAlignment="Left" VerticalAlignment="Top" Margin="70,0,0,0" Foreground="Gray"/>
                                                <TextBlock Text="{Binding Path=Text}" VerticalAlignment="Top" Margin="0,15,0,0"/>
                                            </Grid>
                                        </DataTemplate>
                                    </GridViewColumn.CellTemplate>
                                </GridViewColumn>
                            </GridView>
                        </ListView.View>
                    </ListView>
                </DataTemplate>
            </TabControl.ContentTemplate>
        </TabControl>
        <TextBox Margin="8,0,140,8" VerticalAlignment="Bottom" Height="78" x:Name="textBoxSendMessage" ScrollViewer.VerticalScrollBarVisibility="Auto" AcceptsReturn="True">
            <TextBox.Text>
                <Binding Path="InputText" Mode="TwoWay" />
            </TextBox.Text>
        </TextBox>
        <Button HorizontalAlignment="Right" Margin="0,0,10,8" VerticalAlignment="Bottom" Width="100" Height="77" Content="Envoyer" x:Name="buttonSendMessage" Click="buttonSendMessage_Click" />
		<Button HorizontalAlignment="Right" Margin="0,30,120,0" VerticalAlignment="Top" Width="20" Height="20" Content="X" Grid.Row="0" x:Name="buttonClosingTab" Template="{DynamicResource ButtonControlTemplate1}" Click="buttonClosingTab_Click" BorderThickness="1,1,1,1"/>
		<Button VerticalAlignment="Top" Width="100" Height="100" IsEnabled="False" HorizontalAlignment="Right" Margin="0,15,10,0" Visibility="Visible" RenderTransformOrigin="0.5,0.5" x:Name="buttonAvatarInterloc">
			<Button.Background>
				<LinearGradientBrush EndPoint="0,1" StartPoint="0,0" SpreadMethod="Pad">
					<GradientStop Color="#FFF3F3F3" Offset="0"/>
					<GradientStop Color="#FFEBEBEB" Offset="0.5"/>
					<GradientStop Color="#FFDDDDDD" Offset="0.5"/>
					<GradientStop Color="#FFCDCDCD" Offset="1"/>
				</LinearGradientBrush>
			</Button.Background>
			<Button.RenderTransform>
				<TransformGroup>
					<ScaleTransform ScaleX="1" ScaleY="1"/>
					<SkewTransform AngleX="0" AngleY="0"/>
					<RotateTransform Angle="0"/>
					<TranslateTransform X="0" Y="0"/>
				</TransformGroup>
			</Button.RenderTransform>
			<Image x:Name="imageAvatarInterloc" Width="Auto" Height="Auto" Source="Avatar.jpg" Stretch="UniformToFill"/>
		</Button>
	</Grid>
</Window>